package org.mca.mcaweb.dao;

import java.io.Serializable;

import javax.inject.Inject;

import org.hibernate.Criteria;
import org.hibernate.Session;
import org.hibernate.criterion.Restrictions;
import org.mca.mcaweb.entity.Usua;

public class UsuaDAO implements Serializable {

	private static final long serialVersionUID = -46935803151874134L;

	@Inject
	private DAO<Usua> usuaDAO;

	public Usua verifyUsua(Usua usua) {
		Session s = (Session) usuaDAO.getEm().getDelegate();
		Criteria c = s.createCriteria(Usua.class);
		c.add(Restrictions.eq("usualogin", usua.getUsualogin()));
		c.add(Restrictions.eq("usuasenha", usua.getUsuasenha()));

		Usua bdUser = (Usua) c.uniqueResult();
		return bdUser;
	}
	
	public DAO<Usua> getDAO(){
		return this.usuaDAO;
	}

}